import { verifyAccessToken } from '~/utils/jwt-utils';
import { unAuthorizedResponse, useResponseSuccess } from '~/utils/response';

interface LedgerRecycleItem {
  accountant: string;
  actionAccountant: string;
  deleteTime: string;
  id: string;
  ledgerName: string;
  remark?: string;
  supervisor: string;
}

// 生成空的mock数据，因为回收站通常是空的
const mockData: LedgerRecycleItem[] = [];

export default eventHandler(async (event) => {
  const userinfo = verifyAccessToken(event);
  if (!userinfo) {
    return unAuthorizedResponse(event);
  }

  const query = getQuery(event);
  const page = Number(query.page) || 1;
  const pageSize = Number(query.pageSize) || 20;

  // 分页处理
  const startIndex = (page - 1) * pageSize;
  const endIndex = startIndex + pageSize;
  const listData = mockData.slice(startIndex, endIndex);

  return useResponseSuccess({
    list: listData,
    total: mockData.length,
    page,
    pageSize,
  });
});